﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace Inference
{
    public partial class Form1 : Form
    {
        string ConnectionString;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            LV concl = new LV(ConnectionString);
            concl.StartConclusion();
            BtnResults.Enabled = true;
        }

        private void BtnResults_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("Функция находится на стадии разработки");
            FormResult res = new FormResult();
            res.ConnectionString=ConnectionString;
            res.Show();
        }

        private void BtnOpenDB_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "База данных SQL Server (*.mdf)|*.mdf";
            openFileDialog1.FileName = "";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + openFileDialog1.FileName +
            ";Integrated Security=True;Connect Timeout=30;User Instance=True";
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Данил\\Documents\\Tale.mdf" +
            //    ";Integrated Security=True;Connect Timeout=30;User Instance=True";
            ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + Directory.GetCurrentDirectory() +
           "\\Tale.mdf" + ";Integrated Security=True;Connect Timeout=30;User Instance=True";
        }
    }
}
